using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class Tbs_BillstoReviewMap : EntityTypeConfiguration<Tbs_BillstoReview>
    {
        public Tbs_BillstoReviewMap()
        {
            // Primary Key
            this.HasKey(t => new { t.Number, t.Document_Type, t.DATE });

            // Properties
            this.Property(t => t.batch)
                .HasMaxLength(10);

            this.Property(t => t.Bill__)
                .HasMaxLength(8);

            this.Property(t => t.Number)
                .IsRequired()
                .HasMaxLength(8);

            this.Property(t => t.Document_Type)
                .IsRequired()
                .HasMaxLength(4);

            this.Property(t => t.Patient)
                .HasMaxLength(80);

            // Table & Column Mappings
            this.ToTable("Tbs_BillstoReview");
            this.Property(t => t.batch).HasColumnName("batch");
            this.Property(t => t.Bill__).HasColumnName("Bill_#");
            this.Property(t => t.Number).HasColumnName("Number");
            this.Property(t => t.Document_Type).HasColumnName("Document_Type");
            this.Property(t => t.DATE).HasColumnName("DATE");
            this.Property(t => t.Patient).HasColumnName("Patient");
            this.Property(t => t.closed).HasColumnName("closed");
        }
    }
}
